import os
import sys
import platform

OS_NAME = platform.system();
LIB_DIR=os.environ['LIB_DIR'];
BIN_DIR=os.environ['BIN_DIR'];

env=DefaultEnvironment().Clone()
SOURCES=Glob('*.c')

EXPORT_DEF=''
if OS_NAME == 'Windows':
  EXPORT_DEF = ' /DEF:"src/modbus.def" '

env['LIBS'].remove('modbus')
LINKFLAGS=env['LINKFLAGS'] + EXPORT_DEF 
env.SharedLibrary(os.path.join(BIN_DIR, 'modbus'), SOURCES, LINKFLAGS=LINKFLAGS);

